﻿using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using SX.Infrastructure;
using Microsoft.AspNetCore.Identity;
using SX.Module.Core.Extensions;
using SX.Module.Core.Models;
using SX.Module.Core.Services;
using SmartSql.DyRepository;
using SX.Entity;
using SX.Services;

namespace SX.Module.Core
{
    public class ModuleInitializer : IModuleInitializer
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped<SignInManager<Users>, SimplSignInManager<Users>>();
            //services.AddScoped<IWorkContext, WorkContext>(); 
            services.AddRepositoryFromAssembly((options) =>
            {
                options.AssemblyString = "SX.Module.Core";
                options.Filter = (type) => { return type.IsInterface && type.IsSubclassOf(typeof(IRepository)); };
            });

            services.AddSingleton<UserService>();
        }

        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
        }
    }
}
